import {request} from '@/plugins/request'
export const getArticle = data => {
    return request({
        method: 'GET',
        url: '/api/articles',
        data
    })
}
export const getFeedArticle = data => {
    return request({
        method: 'GET',
        url: '/api/articles/feed',
        data
    })
}
export const addFavorite = data => {
    return request({
        method: 'post',
        url: `/api/articles/${data}/favorite`,
        data
    })
}
export const deleteFavorite = data => {
    return request({
        method: 'delete',
        url: `/api/articles/${data}/favorite`
    })
}
//获取文章详情
export const articleInfo = data => {
    return request({
        method: 'get',
        url: `/api/articles/${data}`
    })
}
//新建文章
export const createdArticle = data => {
    return request({
        method: 'post',
        url: `/api/articles`,
        data
    })
}
//文章评论
export const getComments = data => {
    return request({
        method: 'get',
        url: `/api/articles/${data}/comments`
    })
}

export const addComments = (body,slug) => {
    return request({
        method: 'post',
        url: `/api/articles/${slug}/comments`,
        data:{body}
    })
}

